<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/11/28 0028
  Time: 9:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script>
        function atest() {
            //创建对象
            var xhr = new XMLHttpRequest();
            //注册事件
            xhr.onreadystatechange=function () {
                // console.log(xhr.readyState);
                if(xhr.readyState==4){
                    console.log(xhr.responseText);
                }
            }
            //发送请求
            xhr.open("get","${pageContext.request.contextPath}/servlet?id=100",false);
            xhr.send(null);
            console.log("zizizi")
        }

    </script>
</head>
<body>
<h3>rua!</h3>
<input type="button" value="测试" onclick="atest()">
</body>
</html>
